package com.spzx.common.core.constant;

/**
 * 缓存常量信息
 *
 * @author spzx
 */
public class CacheConstants
{
    /**
     * 缓存有效期，默认720（分钟）
     */
    public final static long EXPIRATION = 720;

    /**
     * 缓存刷新时间，默认120（分钟）
     */
    public final static long REFRESH_TIME = 120;

    /**
     * 密码最大错误次数
     */
    public final static int PASSWORD_MAX_RETRY_COUNT = 5;

    /**
     * 密码锁定时间，默认10（分钟）
     */
    public final static long PASSWORD_LOCK_TIME = 10;

    /**
     * 权限缓存前缀
     */
    public final static String LOGIN_TOKEN_KEY = "login_tokens:";

    /**
     * 验证码 redis key
     */
    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = "sys_config:";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = "sys_dict:";

    /**
     * 登录账户密码错误次数 redis key
     */
    public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";

    /**
     * 登录IP黑名单 cache key
     */
    public static final String SYS_LOGIN_BLACKIPLIST = SYS_CONFIG_KEY + "sys.login.blackIPList";

    /**
     * 商品sku缓存前缀
     */
    public static final String PRODUCT_SKU_KEY = "product:sku:";

    /**
     * 用户购物车缓存前缀
     */
    public static final String USER_CART_KEY = "user:cart:";

    /**
     * 用户订单流水号缓存前缀
     */
    public static final String USER_TRADE_KEY = "user:tradeNo";

    /**
     * 库存锁定数据缓存前缀
     */
    public static final String SKU_LOCK_DATA = "sku:lock:data:";

    /**
     * 商品sku分布式锁前缀
     */
    public static final String LOCK_KEY_PRODUCT_SKU = "product:sku:lock:";

    /**
     * 库存分布式锁前缀
     */
    public static final String SKU_CHECK_AND_LOCK_KEY = "sku:checkAndLock:";

    /**
     * 解锁库存分布式锁前缀
     */
    public static final String SKU_UNLOCK_KEY = "sku:unlock:";

    /**
     * 扣减库存分布式锁前缀
     */
    public static final String SKU_MINUS_KEY = "sku:minus:";

    /**
     * 取消订单分布式锁前缀
     */
    public static final String ORDER_CANCEL_KEY = "order:cancel:";
}
